package com.guigu.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guigu.mapper.SupplierMapper;
import com.guigu.pojo.Supplier;
import com.guigu.service.SupplierService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 供货商信息表 服务实现类
 * </p>
 *
 * @author Mr.Zhang
 * @since 2025 - 03 - 12
 */
@Service
public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> implements SupplierService {
    @Override
    public List<Supplier> getSupplierList(String companyName, String type, int page, int pageSize) {
        int offset = (page - 1) * pageSize;
        return baseMapper.selectSupplierList(companyName, type, offset, pageSize);
    }

    @Override
    public int getSupplierCount(String companyName, String type) {
        return baseMapper.selectSupplierCount(companyName, type);
    }

    @Override
    public List<Supplier> getSupplierWithConsumerNicknameList(String companyName, String type, int page, int pageSize) {
        int offset = (page - 1) * pageSize;
        return baseMapper.selectSupplierWithConsumerNicknameList(companyName, type, offset, pageSize);
    }

    @Override
    public int deleteSupplierById(Integer supplierId) {
        return baseMapper.deleteSupplierById(supplierId);
    }

    @Override
    public int updateSupplier(Supplier supplier) {
        return baseMapper.updateSupplier(supplier);
    }

    @Override
    public List<Supplier> getPendingAndRejectedSupplierList(String companyName, int page, int pageSize, String checkTag) {
        int offset = (page - 1) * pageSize;
        return baseMapper.selectPendingAndRejectedSupplierList(companyName, offset, pageSize, checkTag);
    }

    @Override
    public int getPendingAndRejectedSupplierCount(String companyName, String checkTag) {
        return baseMapper.selectPendingAndRejectedSupplierCount(companyName, checkTag);
    }
}
